﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace CS424_9pts.Account
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginForm.LoggedIn += new EventHandler(LoginForm_LoggedIn);
            
        }

        void LoginForm_LoggedIn(object sender, EventArgs e)
        {
            CreateSession();
        }

        public void CreateSession()
        {
            Session["UserName"] = LoginForm.UserName; 
            MembershipUser user = Membership.GetUser(LoginForm.UserName);
            Session["UserId"] = user.ProviderUserKey.ToString();
        }
    }
}
